package soen343.application;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class FrontCommand {
	protected ServletContext _context;
	
	public void init(ServletContext context) {
		_context = context;
	}
	
	protected void forward(String target, HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException
	{
		RequestDispatcher dispatcher = _context.getRequestDispatcher(target);
		dispatcher.forward(request, response);
	}
	
	public abstract void processRequest(HttpServletRequest request, 
			HttpServletResponse response) throws ServletException, IOException;
}
